summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharles Lombardo <clombardo169@gmail.com>2023-05-02 06:14:58 +0200
committerbunnei <bunneidev@gmail.com>2023-06-03 09:05:58 +0200
commit03541703fa7bc2c349ea7ec80ada7441574e9081 (patch)
treeb7b071afa9db0b02ed02dfda222d29bd599eccfe
parentandroid: New icons for navigation bar (diff)
downloadyuzu-03541703fa7bc2c349ea7ec80ada7441574e9081.tar
yuzu-03541703fa7bc2c349ea7ec80ada7441574e9081.tar.gz
yuzu-03541703fa7bc2c349ea7ec80ada7441574e9081.tar.bz2
yuzu-03541703fa7bc2c349ea7ec80ada7441574e9081.tar.lz
yuzu-03541703fa7bc2c349ea7ec80ada7441574e9081.tar.xz
yuzu-03541703fa7bc2c349ea7ec80ada7441574e9081.tar.zst
yuzu-03541703fa7bc2c349ea7ec80ada7441574e9081.zip
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt
index cc17b8626..0b4ae8744 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt
@@ -20,8 +20,10 @@ import org.yuzu.yuzu_emu.R
import org.yuzu.yuzu_emu.adapters.GameAdapter
import org.yuzu.yuzu_emu.databinding.FragmentGamesBinding
import org.yuzu.yuzu_emu.layout.AutofitGridLayoutManager
+import org.yuzu.yuzu_emu.model.Game
import org.yuzu.yuzu_emu.model.GamesViewModel
import org.yuzu.yuzu_emu.model.HomeViewModel
+import java.util.Locale
class GamesFragment : Fragment() {
private var _binding: FragmentGamesBinding? = null
@@ -73,7 +75,7 @@ class GamesFragment : Fragment() {
binding.swipeRefresh.isRefreshing = isReloading
}
gamesViewModel.games.observe(viewLifecycleOwner) {
- (binding.gridGames.adapter as GameAdapter).submitList(it)
+ submitGamesList(it)
if (it.isEmpty()) {
binding.noticeText.visibility = View.VISIBLE
} else {
@@ -83,7 +85,7 @@ class GamesFragment : Fragment() {
gamesViewModel.shouldSwapData.observe(viewLifecycleOwner) { shouldSwapData ->
if (shouldSwapData) {
- (binding.gridGames.adapter as GameAdapter).submitList(gamesViewModel.games.value)
+ submitGamesList(gamesViewModel.games.value!!)
gamesViewModel.setShouldSwapData(false)
}
}
@@ -107,6 +109,11 @@ class GamesFragment : Fragment() {
}
}
+ private fun submitGamesList(gameList: List<Game>) {
+ val sortedList = gameList.sortedBy { it.title.lowercase(Locale.getDefault()) }
+ (binding.gridGames.adapter as GameAdapter).submitList(sortedList)
+ }
+
override fun onDestroyView() {
super.onDestroyView()
_binding = null